import pandas as pd
from pyecharts import options as opts
from pyecharts.charts import Graph
from pyecharts.globals import ThemeType
df1=pd.df=pd.read_excel('to.xlsx',sheet_name='Sheet1')
list_nodes=df1.to_dict(orient='records')
print(list_nodes)
df2=pd.df=pd.read_excel('to.xlsx',sheet_name='Sheet2')
list_links=df2.to_dict(orient='records')
print(list_links)
df3=pd.df=pd.read_excel('to.xlsx',sheet_name='Sheet3')
list_categorys=df3.to_dict(orient='records')
print(list_categorys)
graph=Graph(init_opts=opts.InitOpts(
    width='750px',height='700px',page_title='关系图')
)
graph.add(series_name='',nodes=list_nodes,links=list_links,categories=list_categorys,repulsion=8000,edge_label=opts.LabelOpts(
    position='middle',formatter='{b} {c}'))
graph.set_global_opts(
    title_opts=opts.TitleOpts(
        title='关系图',pos_left='center'),
    legend_opts=opts.LegendOpts(
        pos_top='50%',pos_right='1%',orient='vertical')
)
graph.render('例8-3.html')